//计算战场单位拥挤地图
//用法：按"内存数据中的部队"构建拥挤地图，按"显示的部队图形"构建拥挤地图
var troopCrowed = {
	GetScriptCrowedMap : function(troop, tileEngine){
		var crowedMap = CreateArray(0, tileEngine.tileCount, 0, false);
		for (var troopid = 0; troopid < troop.length; troopid++){
			if (troop[troopid].strength <= 0) continue;
			
			if (troop[troopid].court_force)
				continue;
			
			crowedMap[troop[troopid].tileIndex]++;
		}
		return crowedMap;
	},
	
	GetSpriteCrowedMap : function(troopHolders, tileEngine){
		var crowedMap = CreateArray(0, tileEngine.tileCount, 0, false);
		for (var troopid = 0; troopid < troopHolders.length; troopid++){
			if (troopHolders[troopid] == null || troopHolders[troopid].visible == false)
				continue;
			
			var tileIndex = tileEngine.CoordToIndex({
				x:troopHolders[troopid].x,
				y:troopHolders[troopid].y});
			
			crowedMap[tileIndex]++;
		}
		return crowedMap;
	},
}